#include "CTimerDispatcher.h"

void callback1(void* pData);
void callback2(void* pData);
void callback3(void* pData);
void callback4(void* pData);
void callback5(void* pData);

CTimerDispatcher timerDispatcher;

void setup()
{
   // initialize serial communication at 9600 bits per second:
   Serial.begin(9600);

   timerDispatcher.startTimer(1000U, 2000U, 0, callback1); // Fire after 1 second. then fire every 2 seconds
   timerDispatcher.startTimer(0U, 500U, 0, callback2); // Fire every half of a second
   timerDispatcher.startTimer(250U, 0U, 0, callback3); // Fire once after 250 ms from the start
   timerDispatcher.startTimer(0U, 3000U, 0, callback4); // Fire every 3 seconds
   timerDispatcher.startTimer(0U, 1000U, 0, callback5); // Fire every 3 seconds
   
   timerDispatcher.stopTimer(2);
}

// the loop routine runs over and over again forever:
void loop()
{
   HwTimerIsr();
   delay(1000);
}

// A set of callback methods
void callback1(void* pData)
{
   Serial.println("Timer 1 is fired");
}
void callback2(void* pData)
{
   Serial.println("Timer 2 is fired");
}
void callback3(void* pData)
{
   Serial.println("Timer 3 is fired");
}
void callback4(void* pData)
{
   Serial.println("Timer 4 is fired");
}
void callback5(void* pData)
{
   Serial.println("Timer 5 is fired");
}
